package main;

public class DecimaltoBaseN {
    public static String convert(int num, int base) {
        String string = new String();
        while(num>0) {
            string = "0123456789ABCDEFGHIJKLMNOPQRSTVW".charAt(num%base) + string;
            num = num/base;
        }
        return string;
    }

    public static void main(String args[])
    {
        System.out.println(convert(255, 2));    // Doi 255 tu co so 10 sang co so 2
        System.out.println(convert(255, 8));    // Doi 255 tu co so 10 sang co so 8
        System.out.println(convert(255, 16));
     
    }
} 